﻿/*
 * @Autor: PK
 * @Date: 2021-03-31 16:29:01
 * @Description: 通过反射直接创建对应工厂实例，不用设置属性的话可以直接用这个
 */

using System;
using System.Collections.Generic;
using ShkSimulation.core.dao.input.resource;
using ShkSimulation.core.template;
using ShkSimulation.core.template.agency;

namespace ShkSimulation.core.factory {
    public static class FactoryProvider {
        
        public static T CreateFactory<T>(NetworkInputData environment, string resourceKey) {
            return (T)Activator.CreateInstance(typeof(T), resourceKey);
        }
        
        public static AgencyFactory CreateFactory(string resourceKey, CreateAgenciesFunction agencyCreateFunction){
            return new AgencyFactoryByResource(resourceKey, agencyCreateFunction);
        }
        
        public static AgencyFactory CreateFactory(string resourceKey, CreateSingleAgencyFunction agencyCreateFunction){
            return new AgencyFactoryByCreateParam(resourceKey, agencyCreateFunction);
        }
    }
}
